package com.hucsmn.phone;

/**
 * 用户消费信息类。
 */
public class Bill {
    /**
     * 统计通话时长。
     */
    private double duration;

    /**
     * 统计上网流量。
     */
    private long traffic;

    /**
     * 每月消费金额。
     */
    private double cost;

    public Bill() {
    }

    public Bill(double duration, long traffic, double cost) {
        setDuration(duration);
        setTraffic(traffic);
        setCost(cost);
    }

    public double getDuration() {
        return duration;
    }

    public void setDuration(double duration) {
        if (!Double.isFinite(duration) || duration < 0.0) {
            throw new IllegalArgumentException();
        }
        this.duration = duration;
    }

    public long getTraffic() {
        return traffic;
    }

    public void setTraffic(long traffic) {
        if (traffic < 0) {
            throw new IllegalArgumentException();
        }
        this.traffic = traffic;
    }

    public double getCost() {
        return cost;
    }

    public void setCost(double cost) {
        if (!Double.isFinite(cost)) {
            throw new IllegalArgumentException();
        }
        this.cost = cost;
    }
}
